package connezione;

import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author sestari
 */
public class BeanPool {

    private ConnectionPool pool;

    /** creare una instance per BeanPool */
    public BeanPool() {
        connect();
    }

    public void connect() {
        try {
            Properties props = new Properties();
            props.put("charSet", "ISO-8859-1");
            props.put("user", "user15");
            props.put("password", "useRPass15");

            pool = new ConnectionPool.Builder().setInitialCapacity(5).setMaxCapacity(20).setStep(2).setConnectionString("jdbc:mysql://ares.science.unitn.it/db_user15").setDriver("com.mysql.jdbc.Driver").setProperties(props).setTimeOut(0).build();
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(BeanPool.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    public ConnectionPool getPool() {
        return pool;
    }
}
